#include <iostream>
#include <string.h>
#include <stdio.h>
#include <bitset>
#include "CommFormat.h"

using namespace std;

int main (void)
{
	struct ReqCtrlMsg tmp;
	tmp.type = 1;
	tmp.resp = 2;
	tmp.vlink_num = 3;
	tmp.stat = 4;

	char s[4];
	memcpy(s, &tmp, 4);
	for (int i=0; i < 4; i++) 
	{
		cout << (int)s[i] << endl;
	}
	//cout << s << endl;
    unsigned short int header = 61441;//1111000000000001
    unsigned short int length = 61441;//1111000000000001
    string binary ((char*)&header, 2);
    unsigned short int h = *((int*)binary.c_str());
    cout << h << endl;
    binary += string ((char*)&length, 2);

    /*
    bitset<32> set(binary);
    cout << set.to_string() << endl;
    char t[5] = {'\0'};

    memcpy(t, &header, 2);
    memcpy(t+2, &length, 2);
    unsigned int x = 4026658817;
    char b[5] = {'\0'};
	for (int i=0; i < 4; i++) 
	{
		//cout << (unsigned char)t[i] << endl;
        printf ("%u\n", t[i]);
	}
    */


	return 0;
}
